package com.yax.mickey.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yax.mickey.entity.Feedback;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author yax
* @description 针对表【feedback(反馈信息表)】的数据库操作Mapper
* @createDate 2024-05-27 09:04:15
* @Entity com.yax.mickey.entity.Feedback
*/
@Mapper
public interface FeedbackMapper extends BaseMapper<Feedback> {

    @Select("select * from feedback")
    List<Feedback> getAllFeedback();

    @Select("select * from feedback where feedback_id = #{feedbackId}")
    Feedback getFeedbackByFeedbackId(Integer feedbackId);

    @Select("select * from feedback where user_id = #{userId}")
    List<Feedback> getFeedbackByUserId(Integer userId);

    @Insert("insert into `feedback` (feedback_id, user_id, feedback_content, rating, feedback_time) \n" +
            "values (#{feedbackId}, #{userId}, #{feedbackContent}, #{rating}, Now());")
    Integer addFeedback(Feedback feedback);
}




